package com.leon.user.controller.v1;


import com.leon.apis.user.ApUserRealnameControllerApi;
import com.leon.common.constants.user.UserConstans;
import com.leon.model.common.dtos.PageResponseResult;
import com.leon.model.common.dtos.ResponseResult;
import com.leon.model.user.dtos.AuthDto;
import com.leon.user.service.ApUserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/user/auth")
public class ApUserRealnameController implements ApUserRealnameControllerApi {

    @Autowired
    private ApUserRealnameService userRealnameService;

    @PostMapping("/list")
    @Override
    public PageResponseResult loadListByStatus(@RequestBody AuthDto dto){
        PageResponseResult pageResponseResult = userRealnameService.loadListByStatus(dto);
        return pageResponseResult;
    }

    @Override
    @PostMapping("/authPass")
    public ResponseResult authPass(AuthDto dto) {
        return userRealnameService.updateStatusById(dto, UserConstans.PASS_AUTH);
    }

    @Override
    @PostMapping("/authFail")
    public ResponseResult authFail(AuthDto dto) {
        return userRealnameService.updateStatusById(dto,UserConstans.FAIL_AUTH);
    }


}